import {PAGE_NAME} from "@/views/securityCheck/defectQuestion/listPage/config";
import {HANDEL_CODE_CONFIG} from "@/views/securityCheck/ztDefectInspect/components/eventConfig";
import {BT_TYPE, QUESTION_STATE} from "@/constantData";


const LIST_PAGE_FUN = {
  [PAGE_NAME.HiddenDangerListPage]: {
    HANDEL_BT: [
      {
        type: BT_TYPE.primary,
        icon: "el-icon-search",
        size: "mini",
        label: '搜索',
        fun: 'handleQuery',
        baseParam: {},
        filterFun: ({inspectInfo, handelCode}) => {
          return true
        }
      },
      {
        type: '',
        icon: "el-icon-refresh",
        size: "mini",
        label: '重置',
        fun: 'resetQuery',
        baseParam: {},
        filterFun: ({inspectInfo, handelCode}) => {
          return true
        }
      },
      {
        type: BT_TYPE.primary,
        icon: "el-icon-refresh",
        size: "mini",
        label: '新 增 隐 患',
        fun: 'handleAdd',
        baseParam: {},
        filterFun: ({inspectInfo, handelCode}) => {
          return handelCode == HANDEL_CODE_CONFIG.ADD_HIDDEN_DANGER
        }
      },
      {
        type: BT_TYPE.primary,
        icon: "el-icon-refresh",
        size: "mini",
        label: '退回',
        fun: 'batchAudit',
        baseParam: {result: 'N'},
        filterFun: ({inspectInfo, handelCode}) => {
          return handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA
        }
      },
      {
        type: BT_TYPE.primary,
        icon: "el-icon-refresh",
        size: "mini",
        label: '通过',
        fun: 'batchAudit',
        baseParam: {result: 'Y'},
        filterFun: ({inspectInfo, handelCode}) => {
          return handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA
        }
      },
    ],
    TABLE_BT: [
      {
        type: BT_TYPE.text,
        icon: "el-icon-edit",
        size: "mini",
        label: '编辑',
        fun: 'handleAdd',
        baseParam: null,
        filterFun: ({inspectInfo, handelCode, row}) => {
          return handelCode == HANDEL_CODE_CONFIG.ADD_HIDDEN_DANGER && row.questionState == QUESTION_STATE.draft
        }
      },
      {
        type: BT_TYPE.text,
        icon: "el-icon-search",
        size: "mini",
        label: '详情',
        fun: 'handleInfo',
        baseParam: null,
        filterFun: ({inspectInfo, handelCode, row}) => {
          return true
        }
      },
      {
        type: BT_TYPE.text,
        icon: "",
        size: "mini",
        label: '撤回',
        fun: 'handleRevoke',
        baseParam: null,
        filterFun: ({inspectInfo, handelCode, row}) => {
          return handelCode == HANDEL_CODE_CONFIG.ADD_HIDDEN_DANGER && row.questionState == QUESTION_STATE.official
        }
      },
      {
        type: BT_TYPE.text,
        icon: "",
        size: "mini",
        label: '删除',
        fun: 'handleDelete',
        baseParam: null,
        filterFun: ({inspectInfo, handelCode, row}) => {
          return handelCode == HANDEL_CODE_CONFIG.ADD_HIDDEN_DANGER && row.questionState == QUESTION_STATE.draft
        }
      },
      {
        type: BT_TYPE.text,
        icon: "",
        size: "mini",
        label: '确认',
        fun: 'audit',
        baseParam: {result: 'Y',url:'/business/defect/defectQuestionCheck/checkDefectQuestion'},
        filterFun: ({inspectInfo, handelCode, row}) => {
          return handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA_FGLDQR || handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA_ZZQLDQR  || handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA_MSLDQR
        }
      },
      {
        type: BT_TYPE.text,
        icon: "",
        size: "mini",
        label: '退回',
        fun: 'audit',
        baseParam: {result: 'N',url:'/business/defect/defectQuestionCheck/checkDefectQuestion'},
        filterFun: ({inspectInfo, handelCode, row}) => {
          return handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA_FGLDQR || handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA_ZZQLDQR  || handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA_MSLDQR
        }
      },
      {
        type: BT_TYPE.text,
        icon: "",
        size: "mini",
        label: '通过',
        fun: 'audit',
        baseParam: {result: 'Y',url:'/business/defect/defectQuestionCheck/csDefectQuestion'},
        filterFun: ({inspectInfo, handelCode, row}) => {
          return handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA_ZZQCS || handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA_MSCS
        }
      },
      {
        type: BT_TYPE.text,
        icon: "",
        size: "mini",
        label: '退回',
        fun: 'audit',
        baseParam: {result: 'N',url:'/business/defect/defectQuestionCheck/csDefectQuestion'},
        filterFun: ({inspectInfo, handelCode, row}) => {
          return  handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA_ZZQCS || handelCode == HANDEL_CODE_CONFIG.REVIEW_DATA_MSCS
        }
      },
    ],
  }
}

export {LIST_PAGE_FUN}
